package main

import "fmt"

func main() {
	//go语言 交换两个变量的值
	var a int = 10
	var b int = 20
	fmt.Println("a=", a, "b=", b)
	//方法一：定义临时变量
	var temp int
	temp = a
	a = b
	b = temp
	fmt.Println("a=", a, "b=", b)
	//方法二：不使用临时变量
	a = a + b
	b = a - b
	a = a - b
	fmt.Println("a=", a, "b=", b)
	//方法三：使用异或运算
	a = a ^ b
	b = a ^ b
	a = a ^ b
	fmt.Println("a=", a, "b=", b)

	//写个demo学习go语言等于 不等于 大于 小于 大于等于 小于等于
	var c int = 10
	var d int = 20
	fmt.Println("c=", c, "d=", d)
	fmt.Println("c==d", c == d)
	fmt.Println("c!=d", c != d)
	fmt.Println("c>d", c > d)
	fmt.Println("c<d", c < d)
	fmt.Println("c>=d", c >= d)
	fmt.Println("c<=d", c <= d)

}
